package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-11-06 14:47
 **/
public class LeetCode295 {

    /*//存储较大的一半元素
    Queue<Integer> big;
    //存储较小的一半元素
    Queue<Integer> small;

    *//** initialize your data structure here. *//*
    public MedianFinder() {
        //小顶堆big
        big = new PriorityQueue<>();
        //大顶堆small
        small = new PriorityQueue<>((x, y) -> (y - x));
    }

    public void addNum(int num) {
        if (big.size() == small.size()) {
            small.offer(num);
            big.offer(small.poll());
        } else {
            big.offer(num);
            small.offer(big.poll());
        }
    }

    public double findMedian() {
        return big.size() != small.size() ? big.peek() : (big.peek() + small.peek()) / 2.0;
    }*/

}
